/*
 * Goods.java
 * business
 *
 * Created by ChenTao on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.data.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

/**
 * 商品
 */
public class Goods implements Parcelable {

    /**
     * 购物车中商品选中状态
     */
    private boolean isSelected;
    /**
     * 供应商ID
     */
    @SerializedName("supplier_id")
    private String supplierId;
    @SerializedName("id")
    private String id;
    @SerializedName("name")
    private String name;
    @SerializedName("count")
    private String count;
    @SerializedName("notice")
    private String notice;
    @SerializedName("formated_goods_price")
    private String formatedGoodsPrice;
    @Expose
    @SerializedName("goods_price")
    private float goodsPrice;
    @SerializedName("type")
    private String type;
    @SerializedName("supplier_name")
    private String supplierName;
    @Expose
    @SerializedName("goods_number")
    private int goodsNumber;
    @Expose
    @SerializedName("rec_id")
    private String recId;
    @SerializedName("goods_id")
    private String goodsId;
    @SerializedName("goods_name")
    private String goodsName;
    @SerializedName("goods_thumb")
    private String goodsThumb;
    @SerializedName("shop_price")
    private String shopPrice;
    @SerializedName("url")
    private String url;
    @SerializedName("stock_number")
    private int stockNumber;
    @SerializedName("total")
    private int total;
    @SerializedName("original_img")
    private String originalImg;
    @SerializedName("goods_brand")
    private String goodsBrand;
    @SerializedName("goods_weight")
    private String goodsWeight;
    @SerializedName("shop_logo")
    private String shopLogo;
    @SerializedName("agent_price")
    private String agentPrice;
    @SerializedName("agent_grade")
    private String agentGrade;
    @SerializedName("can_buy")
    private int canBuy;
    /**
     * 商品活动信息
     */
    @SerializedName("favourable_info")
    private FavourableInfo favourableInfo;
    /**
     * 当前赠品是否可以选择
     */
    @SerializedName("can_chose")
    private int canChoose;
    /**
     * 是否已评价
     */
    @SerializedName("success")
    private int success;
    /**
     * 库存
     */
    @SerializedName("goods_number_desc")
    private String goodsNumberDesc;
    /**
     * sales_num : 已售
     */
    @SerializedName("sales_num")
    private String salesNum;
    /**
     * goods_comm : 规格
     */
    @SerializedName("goods_comm")
    private String goodsComm;
    /**
     * 商品拥有的活动
     */
    @SerializedName("favourable_notice")
    private String favourableNotice;
    @SerializedName("favourable_type")
    private int favourableType;
    @SerializedName("contrast")
    private String contrast;
    @SerializedName("logistics_fee")
    private String logisticsFee;
    @SerializedName("deliverys")
    private String deliverys;
    @SerializedName("shop_price_float")
    private String shopPriceFloat;
    @SerializedName("goods_unit")
    private String goodsUnit;
    @SerializedName("avg_shop_price_float")
    private String avgShopPriceFloat;
    @SerializedName("avg_market_price_float")
    private String avgMarketPriceFloat;
    /**
     * 购物车是否是编辑模式
     */
    private boolean isEditMode;
    @SerializedName("limit_number")
    private int limitNumber;
    @SerializedName("gift_error")
    private String giftError;
    @SerializedName("less_number")
    private int lessNumber;
    @SerializedName("goods_type")
    private int goodsType;
    @SerializedName("goods_state")
    private int goodsState;
    @SerializedName("limit_price")
    private String limitPrice;
    @SerializedName("less_time")
    private long lessTime;
    @SerializedName("start_time")
    private long startTime;
    @SerializedName("end_time")
    private long endTime;
    @SerializedName("now_time")
    private long nowTime;
    @SerializedName("is_sale_off")
    private int isSaleOff;
    @SerializedName("free_money")
    private String freeMoney;
    private int goodsFlagResId;
    private boolean isLast;
    @SerializedName("service_phone")
    private String servicePhone;

    @SerializedName("plus_price")
    private float plusPrice;

    /**
     * 活动的状态
     *
     * @see ACTIVE_STATE
     */
    @SerializedName("state")
    private int state;
    /**
     * 距离活动结束时间
     */
    private long toEndTime;
    /**
     * 距离活动开始时间
     */
    private long toStartTime;
    private int numberHelper;

    // 单瓶价
    @SerializedName("avg_goods_price")
    private String bottlePrice;

    // 特价商品
    @SerializedName("is_special")
    private int isSpecial;

    // 最少购买量
    @SerializedName("min_number")
    private int minNumber;

    public int getMinNumber() {
        return minNumber;
    }

    public void setMinNumber(int minNumber) {
        this.minNumber = minNumber;
    }

    public Goods() {
    }

    protected Goods(Parcel in) {
        this.goodsId = in.readString();
        this.goodsName = in.readString();
        this.goodsPrice = in.readFloat();
        this.goodsNumber = in.readInt();
        this.goodsThumb = in.readString();
        this.formatedGoodsPrice = in.readString();
    }

    public int getIsSpecial() {
        return isSpecial;
    }

    public void setIsSpecial(int isSpecial) {
        this.isSpecial = isSpecial;
    }

    public String getBottlePrice() {
        return bottlePrice;
    }

    public void setBottlePrice(String bottlePrice) {
        this.bottlePrice = bottlePrice;
    }

    public float getPlusPrice() {
        return plusPrice;
    }

    public void setPlusPrice(float plusPrice) {
        this.plusPrice = plusPrice;
    }

    public boolean isLast() {
        return isLast;
    }

    public void setLast(boolean last) {
        isLast = last;
    }

    public int getGoodsFlagResId() {
        return goodsFlagResId;
    }

    public void setGoodsFlagResId(int goodsFlagRes) {
        this.goodsFlagResId = goodsFlagRes;
    }

    public String getFreeMoney() {
        return freeMoney;
    }

    public void setFreeMoney(String freeMoney) {
        this.freeMoney = freeMoney;
    }

    public String getServicePhone() {
        return servicePhone;
    }

    public void setServicePhone(String servicePhone) {
        this.servicePhone = servicePhone;
    }

    public int getNumberHelper() {
        return numberHelper;
    }

    public void setNumberHelper(int numberHelper) {
        this.numberHelper = numberHelper;
    }

    public long getToEndTime() {
        return toEndTime;
    }

    public void setToEndTime(long toEndTime) {
        this.toEndTime = toEndTime;
    }

    public long getToStartTime() {
        return toStartTime;
    }

    public void setToStartTime(long toStartTime) {
        this.toStartTime = toStartTime;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public int getIsSaleOff() {
        return isSaleOff;
    }

    public void setIsSaleOff(int isSaleOff) {
        this.isSaleOff = isSaleOff;
    }

    public int getLessNumber() {
        return lessNumber;
    }

    public void setLessNumber(int lessNumber) {
        this.lessNumber = lessNumber;
    }

    public String getGiftError() {
        return giftError;
    }

    public void setGiftError(String giftError) {
        this.giftError = giftError;
    }

    public boolean isEditMode() {
        return isEditMode;
    }

    public void setEditMode(boolean editMode) {
        isEditMode = editMode;
    }

    public String getAvgShopPriceFloat() {
        return avgShopPriceFloat;
    }

    public void setAvgShopPriceFloat(String avgShopPriceFloat) {
        this.avgShopPriceFloat = avgShopPriceFloat;
    }

    public String getShopPriceFloat() {
        return shopPriceFloat;
    }

    public void setShopPriceFloat(String shopPriceFloat) {
        this.shopPriceFloat = shopPriceFloat;
    }

    public int getFavourableType() {
        return favourableType;
    }

    public void setFavourableType(int favourableType) {
        this.favourableType = favourableType;
    }

    public String getFavourableNotice() {
        return favourableNotice;
    }

    public void setFavourableNotice(String favourableNotice) {
        this.favourableNotice = favourableNotice;
    }

    public int getCanChoose() {
        return canChoose;
    }

    public void setCanChoose(int canChoose) {
        this.canChoose = canChoose;
    }

    public String getShopLogo() {
        return shopLogo;
    }

    public void setShopLogo(String shopLogo) {
        this.shopLogo = shopLogo;
    }

    public FavourableInfo getFavourableInfo() {
        return favourableInfo;
    }

    public void setFavourableInfo(FavourableInfo favourableInfo) {
        this.favourableInfo = favourableInfo;
    }

    public String getGoodsWeight() {
        return goodsWeight;
    }

    public void setGoodsWeight(String goodsWeight) {
        this.goodsWeight = goodsWeight;
    }

    public String getGoodsBrand() {
        return goodsBrand;
    }

    public void setGoodsBrand(String goodsBrand) {
        this.goodsBrand = goodsBrand;
    }

    public String getOriginalImg() {
        return originalImg;
    }

    public void setOriginalImg(String originalImg) {
        this.originalImg = originalImg;
    }

    public boolean isSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }

    public String getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(String supplierId) {
        this.supplierId = supplierId;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getGoodsThumb() {
        return goodsThumb;
    }

    public void setGoodsThumb(String goodsThumb) {
        this.goodsThumb = goodsThumb;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getShopPrice() {
        return shopPrice;
    }

    public void setShopPrice(String shopPrice) {
        this.shopPrice = shopPrice;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getCount() {
        return count;
    }

    public void setCount(String count) {
        this.count = count;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getGoodsNumber() {
        return goodsNumber;
    }

    public void setGoodsNumber(int goodsNumber) {
        this.goodsNumber = goodsNumber;
    }

    public String getRecId() {
        return recId;
    }

    public void setRecId(String recId) {
        this.recId = recId;
    }

    public String getNotice() {
        return notice;
    }

    public void setNotice(String notice) {
        this.notice = notice;
    }

    public float getGoodsPrice() {
        return goodsPrice;
    }

    public void setGoodsPrice(float goodsPrice) {
        this.goodsPrice = goodsPrice;
    }

    public int getStockNumber() {
        return stockNumber;
    }

    public void setStockNumber(int stockNumber) {
        this.stockNumber = stockNumber;
    }

    public String getFormatedGoodsPrice() {
        return formatedGoodsPrice;
    }

    public void setFormatedGoodsPrice(String formatedGoodsPrice) {
        this.formatedGoodsPrice = formatedGoodsPrice;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public String getAgentPrice() {
        return agentPrice;
    }

    public void setAgentPrice(String agentPrice) {
        this.agentPrice = agentPrice;
    }

    public String getAgentGrade() {
        return agentGrade;
    }

    public void setAgentGrade(String agentGrade) {
        this.agentGrade = agentGrade;
    }

    public int getCanBuy() {
        return canBuy;
    }

    public void setCanBuy(int canBuy) {
        this.canBuy = canBuy;
    }

    public int getSuccess() {
        return success;
    }

    public void setSuccess(int success) {
        this.success = success;
    }

    public String getGoodsNumberDesc() {
        return goodsNumberDesc;
    }

    public void setGoodsNumberDesc(String goodsNumberDesc) {
        this.goodsNumberDesc = goodsNumberDesc;
    }

    public String getSalesNum() {
        return salesNum;
    }

    public void setSalesNum(String salesNum) {
        this.salesNum = salesNum;
    }

    public String getGoodsComm() {
        return goodsComm;
    }

    public void setGoodsComm(String goodsComm) {
        this.goodsComm = goodsComm;
    }

    public String getContrast() {
        return contrast;
    }

    public void setContrast(String contrast) {
        this.contrast = contrast;
    }

    public String getLogisticsFee() {
        return logisticsFee;
    }

    public void setLogisticsFee(String logisticsFee) {
        this.logisticsFee = logisticsFee;
    }

    public String getDeliverys() {
        return deliverys;
    }

    public void setDeliverys(String deliverys) {
        this.deliverys = deliverys;
    }

    public String getGoodsUnit() {
        return goodsUnit;
    }

    public void setGoodsUnit(String goodsUnit) {
        this.goodsUnit = goodsUnit;
    }

    public String getAvgMarketPriceFloat() {
        return avgMarketPriceFloat;
    }

    public void setAvgMarketPriceFloat(String avgMarketPriceFloat) {
        this.avgMarketPriceFloat = avgMarketPriceFloat;
    }

    public int getLimitNumber() {
        return limitNumber;
    }

    public void setLimitNumber(int limitNumber) {
        this.limitNumber = limitNumber;
    }

    public static final Creator<Goods> CREATOR =
            new Creator<Goods>() {
                @Override
                public Goods createFromParcel(Parcel source) {
                    return new Goods(source);
                }

                @Override
                public Goods[] newArray(int size) {
                    return new Goods[size];
                }
            };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.goodsId);
        dest.writeString(this.goodsName);
        dest.writeFloat(this.goodsPrice);
        dest.writeInt(this.goodsNumber);
        dest.writeString(this.goodsThumb);
        dest.writeString(this.formatedGoodsPrice);
    }

    public int getGoodsType() {
        return goodsType;
    }

    public void setGoodsType(int goodsType) {
        this.goodsType = goodsType;
    }

    public int getGoodsState() {
        return goodsState;
    }

    public void setGoodsState(int goodsState) {
        this.goodsState = goodsState;
    }

    public String getLimitPrice() {
        return limitPrice;
    }

    public void setLimitPrice(String limitPrice) {
        this.limitPrice = limitPrice;
    }

    public long getLessTime() {
        return lessTime;
    }

    public void setLessTime(long lessTime) {
        this.lessTime = lessTime;
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    public long getNowTime() {
        return nowTime;
    }

    public void setNowTime(long nowTime) {
        this.nowTime = nowTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Goods goods = (Goods) o;

        return goodsId != null ? goodsId.equals(goods.goodsId) : goods.goodsId == null;
    }

    @Override
    public int hashCode() {
        return goodsId != null ? goodsId.hashCode() : 0;
    }

    public interface TYPE {

        /**
         * 普通商品
         */
        int NORMAL = 0;

        /**
         * 首页-限时购商品
         */
        int LIMIT = 1;

        /**
         * 首页-免费赠商品
         */
        int FREE = 2;

        /**
         * 首页-秒杀商品
         */
        int SECOND_KILL = 3;
    }

    /**
     * 活动的状态
     */
    public interface ACTIVE_STATE {

        int UN_START = 0;

        int RUNNING = 1;

        int FINISHED = 2;

        /**
         * 商品是否售罄
         */
        int SALE_OFF = 1;
    }
}
